﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AdmBase;

public partial class admin_pages_newsletter_Default : TelaBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        IsLogado();
        object msg = Session["msg"];
        Session["msg"] = null;
        if (msg != null)
            ShowMensagem("Atenção", msg.ToString());
    }

    private NewsletterBusiness nBusiness;

    public NewsletterBusiness NBusiness
    {
        get
        {
            if (nBusiness == null)
                nBusiness = new NewsletterBusiness();
            return nBusiness;
        }
        set { nBusiness = value; }
    }

    protected void SelectGrid(object sender, EventArgs e)
    {
        GridView grid = (GridView)sender;
        Response.Redirect("~/admin/pages/newsletter/Novo.aspx?id=" + grid.SelectedValue.ToString());
    }


    protected void Deletar(object sender, EventArgs e)
    {
        int id = int.Parse(((LinkButton)sender).CommandName);

        string msg = NBusiness.Deletar(id);
        DataBind();
        GridViewNewsletter.DataBind();
        ShowMensagem("Atenção", msg);
    }
}